// components/end-loading/index.js
import { config } from "../../config/config";
import { InsideNotice } from "../../models/insideNotice";
Component({
  /**
   * 组件的属性列表
   */
  properties: {},

  /**
   * 组件的初始数据
   */
  data: {
    count: 0,
    show: false,
    messageList: [],
    config: config
  },

  attached() {
    this.GetDataListInside();
  },

  /**
   * 组件的方法列表
   */
  methods: {
    async GetDataListInside(pageNum = 1, pageSize = 10) {
      let post = {
        Search: { all: true, userId: "", keyword: null },
        PageIndex: pageNum,
        PageRows: pageSize,
        SortField: "id",
        SortType: "asc"
      };
      const data = await InsideNotice.GetDataListInside(post);
      let count = data.Data.filter(item => {
        return item.Status == 0;
      }).length;
      this.setData({
        messageList: data.Data,
        count
      });
    },
    apply() {
      wx.navigateTo({
        url: `/pages/apply/apply`
      });
      // this.$router.push({
      //   path: "/apply",
      //   query: {
      //     registType: 2
      //   }
      // });
    },
    applyNewProduct() {
      this.setData({
        show: true
      });
    },
    close() {
      this.setData({
        show: false
      });
    },
    goMessage() {
      wx.navigateTo({
        url: `/pages/message/message`
      });
    },
    productManagement() {
      wx.navigateTo({
        url: `/pages/product-management/product-management`
      });
      // this.$router.push({
      //   path: "/product-management"
      // });
    },
    publishProduct() {
      wx.navigateTo({
        url: `/pages/publish-product/publish-product`
      });
      // this.$router.push({
      //   path: "/publish-product"
      // });
    },
    companyInfo() {
      wx.navigateTo({
        url: `/pages/company-info/company-info`
      });
      // this.$router.push({
      //   path: "/company-info"
      // });
    }
  }
});
